﻿Imports System.Transactions
Imports CondorTravel.BE
Imports CondorTravel.DALC

Public Class InformeCampoBC

    Public Function InsertaInformeCampo(ByVal objInformeCampoBE As InformeCampoBE, ByRef bExito As Boolean, ByRef sMensaje As String) As Boolean
        Dim objScope As TransactionScope
        objScope = New TransactionScope

        Using objScope
            Try
                Dim objInformeCampoDALC As InformeCampoDALC = Nothing
                objInformeCampoDALC = New InformeCampoDALC

                If objInformeCampoDALC.InsertarInformeCampo(objInformeCampoBE, bExito, sMensaje) Then
                    objScope.Complete()
                Else
                    objScope.Dispose()
                End If

            Catch ex As Exception
                Throw
            End Try
        End Using

        Return bExito

    End Function

    Public Function ListarInformeCampo(ByVal objInformeCampoBE As InformeCampoBE) As List(Of InformeCampoBE)
        Dim objListaInformeCampo As List(Of InformeCampoBE) = Nothing
        Dim objInformeCampoDALC As InformeCampoDALC = Nothing

        objInformeCampoDALC = New InformeCampoDALC
        objListaInformeCampo = New List(Of InformeCampoBE)()
        objListaInformeCampo = objInformeCampoDALC.ListarInformeCampo(objInformeCampoBE)

        Return objListaInformeCampo
    End Function

    Public Function VerInformeCampo(ByVal codigo As Integer, ByRef bExito As Boolean, ByRef sMensaje As String) As InformeCampoBE
        Dim objInformeCampo As InformeCampoBE = Nothing
        Dim objInformeCampoDALC As New InformeCampoDALC

        objInformeCampo = objInformeCampoDALC.InformeCampoVer(codigo, bExito, sMensaje)

        Return objInformeCampo

    End Function

    Public Function ActualizarInformeCampo(ByVal objInformeCampo As InformeCampoBE, ByRef bExito As Boolean, ByRef sMensaje As String) As Boolean
        Dim objScope As TransactionScope
        objScope = New TransactionScope

        Using objScope
            Try
                Dim objInformeCampoDALC As InformeCampoDALC = Nothing
                objInformeCampoDALC = New InformeCampoDALC

                If objInformeCampoDALC.ActualizarInformeCampo(objInformeCampo, bExito, sMensaje) Then
                    objScope.Complete()
                Else
                    objScope.Dispose()
                End If

            Catch ex As Exception
                Throw
            End Try
        End Using

        Return bExito
    End Function

End Class
